﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataContext;
using DAL;
namespace WorkFlowBLL
{
    public class CtrTable
    {
        #region Range
        public List<DataContext.uspRangeGetAllResult> RangeGetAll()
        {
            return TableInstance.CreateInstance().uspRangeGetAll().ToList();
        }
        public List<DataContext.uspRangeGetByStatusResult> RangeGetByStatus(int status)
        {
            return TableInstance.CreateInstance().uspRangeGetByStatus(status).ToList();
        }
        public int RangeInsert(string rangeName, int status)
        {
            return TableInstance.CreateInstance().uspRangeInsert(rangeName, status);
        }
        public int RangeUpdate(string rangeName, int status, int rangeID)
        {
            return TableInstance.CreateInstance().uspRangeUpdateByRangeID(rangeID, rangeName, status);
        }
        public int RangeDelete(int rangeID)
        {
            return TableInstance.CreateInstance().uspRangeDeleteByRangeID(rangeID);
        }
        #endregion

        #region Table
        public List<DataContext.uspTableGetAllResult> TableGetAll()
        {
            return TableInstance.CreateInstance().uspTableGetAll().ToList();
        }
        public List<DataContext.uspTableGetByRangeIDResult> TableGetByRangeID(int rangeID, int status)
        {
            return TableInstance.CreateInstance().uspTableGetByRangeID(rangeID, status).ToList();
        }
        /// <summary>
        /// Lấy trạng thái bàn đang có khách hay không
        /// </summary>
        /// <param name="rangeID"></param>
        /// <returns></returns>
        public List<DataContext.uspTableGetOnResult> TableGetOn(int rangeID)
        {
            return TableInstance.CreateInstance().uspTableGetOn(rangeID).ToList();
        }
        public int TableInsert(string tableCode, string tableName, int status, int rangeID)
        {
            return TableInstance.CreateInstance().uspTableInsert(tableCode, tableName, rangeID, status);
        }
        public int TableUpdate(string tableCode,string tableName, int status, int rangeID, int tableID)
        {
            return TableInstance.CreateInstance().uspTableUpdateByTableID(tableID, tableCode, tableName,rangeID, status);
        }
        public int TableDelete(int tableID)
        {
            return TableInstance.CreateInstance().uspTableDeleteByTableID(tableID);
        }
        #endregion
    }
}
